{extend name="base"}
{block name="title"}渠道查询{/block}
{block name="head"}
<style>
.border-table{font-size:12px; color:#666;}
</style>
{/block}
{block name="body"}
<body class="mainbody">
<form>
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i class="iconfont icon-up"></i><span>返回上一页</span></a>
  <a href="{:url('index/home')}" class="home"><i class="iconfont icon-home"></i><span>首页</span></a>
  <i class="arrow iconfont icon-arrow-right"></i>
  <span>渠道查询</span>
</div>

<div class="table-container" style="margin:20px 0 0 0;">
  <table class="border-table">
    <thead>
      <tr>
        <th></th>
        <th>渠道</th>
        <th>当前版本</th>
        <th>创建时间</th>
        <th>更新时间</th>
        <th>关联游戏</th>
        <th>更新记录</th>
        <th rowspan="2">操作</th>

      </tr>
     
    </thead>
    <tbody>
{empty name="list"}
      <tr><td colspan="13">Oh~暂无数据!</td></tr>
{else/}
    {volist name="list" id="v"}
    <tr data-id="{$v.ID}">
      <td>{$v.ROW_NUMBER}</td>
      <td style="text-align: left;">[{$v.ID}]{$v.Name}</td>
      <td>{$v.Version}</td>
      <td>{$v.CreateTime}</td>
      <td>{$v.UpdateTime}</td>
      <td>{$v.TotalGame}</td>
      <td><a target="_blank" href="{:url('system.channel.version/index')}?channel={$v.ID}">{$v.TotalVersion}</a></td>
      <td>

        <input type="button" class="a" value="修改版本" />
        
      </td>
    </tr>
    {/volist}
{/empty}
    </tbody>
  </table>
</div>

<div class="page-footer"><div class="btn-wrap">{$list->render()}</div></div>

<script>
$(function() {

  
  $('input.a').click(function () {  // 改版本
    var id = $(this).parents('tr').data('id');
    var url = "{:url('system.channel.version/detail')}?id=" + id;
    dialog({
      title: '渠道[' + id + ']版本',
      url: url,
      width: 500,
      height: 280,
      okValue: '确定',
      cancelValue: '取消',
      cancel: function () {},
      ok: function () {
        var f = $('iframe', this.node);
        var v = $('form', f.contents()).serialize();
        console.log(v);
        $.post(url, v, function (resp, text, xhr) {
          console.log(resp);
          alert(resp.error);
          if (resp.errno == 0 || resp.errno == 110) {
            location.reload();
          }
        });
        return false;
      }
    }).showModal();
  });
  
});
</script>
</form>
</body>
{/block}